import request from '@/utils/request'

export function institutionList(data) { //机构列表
  JSON.stringify(data)
  return request({
    url: '/upms/organization/search',
    method: 'get',
    params : data
  })
}

export function addOrg (data) { //新增机构
  return request({
    url: '/upms/organization',
    method: 'post',
    data
  })
}
export function compileOrg (data) {//编辑机构
  return request({
    url: '/upms/organization',
    method: 'put',
    data
  })
}
export function delOrg (orgId) {//删除
  return request({
    url: '/upms/organization',
    method: 'DELETE',
    params: { orgId }
  })
}

export function allStaff () {//所有员工
  return request({
    url: '/upms/emp/search',
    method: 'get',
  })
}
export function allPost () {//所有职位
  return request({
    url: '/upms/post/search',
    method: 'get',
  })
}

export function orgStaff(data) {//机构关联员工
  return request({
    url: '/upms/organization/emp/join',
    method: 'post',
    data
  })
}

export function orgAllStaff (orgId) {//获取机构下面所有的员工
  return request({
    url: '/upms/organization/emp/search',
    method: 'get',
    params: { orgId }
  })
}

export function staffOutOrg (data) {//员工退出部门
  return request({
    url: '/upms/organization/emp/leave',
    method: 'put',
    data
  })
}
